/*
Name: Kabir Kang
File: unittest1.c
Date: 7/13/14
Summary: This tests the getCost() function
*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>

int getCostTest(int cardNumber)
{
  switch( cardNumber ) 
    {
    case curse:
      return 0;
    case estate:
      return 2;
    case duchy:
      return 5;
    case province:
      return 8;
    case copper:
      return 0;
    case silver:
      return 3;
    case gold:
      return 6;
    case adventurer:
      return 6;
    case council_room:
      return 5;
    case feast:
      return 4;
    case gardens:
      return 4;
    case mine:
      return 5;
    case remodel:
      return 4;
    case smithy:
      return 4;
    case village:
      return 3;
    case baron:
      return 4;
    case great_hall:
      return 3;
    case minion:
      return 5;
    case steward:
      return 3;
    case tribute:
      return 5;
    case ambassador:
      return 3;
    case cutpurse:
      return 4;
    case embargo: 
      return 2;
    case outpost:
      return 5;
    case salvager:
      return 4;
    case sea_hag:
      return 4;
    case treasure_map:
      return 4;
    }
  
  return -1;
}

void test()
{
  int i;
  int card[27] = {curse,estate,duchy,province,copper,silver,gold,adventurer,council_room,feast,gardens,mine,remodel,smithy,village,baron,great_hall,minion,steward,tribute,ambassador,cutpurse,embargo,outpost,salvager,sea_hag,treasure_map};

  for (i=0;i<27;i++)
    {
      if(getCostTest(card[i])<0)
	{
	  printf("getCost(): FAIL when test attempts to get card cost. \n");
	  break;
	}
      if(i==26)
	{
	  printf("getCost(): PASS when test attempts to get card cost. \n");
	}
    }

  if(getCostTest(province) == 8)
    {
      printf("getCost(): PASS when getting province cost. \n");
    }
  else
    {
      printf("getCost(): FAIL when getting province cost. \n");
    }
  if(getCostTest(great_hall) == 3)
    {
      printf("getCost(): PASS when getting great_hall cost. \n");
    }
  else
    {
      printf("getCost(): FAIL when getting great_hall cost. \n");
    }
  if(getCostTest(embargo) == 2)
    {
      printf("getCost(): PASS when getting embargo cost. \n");
    }
  else
    {
      printf("getCost(): FAIL when getting embargo cost. \n");
    }
  if(getCostTest(treasure_map) == 4)
    {
      printf("getCost(): PASS when getting treasure_map cost. \n");
    }
  else
    {
      printf("getCost(): FAIL when getting treasure_map cost. \n");
    }

}

int main(int argc, char *argv[])
{
  test();
  return 0;
}
